package com.st.controller;

import com.st.dao.BookDao;
import com.st.pojo.BookBean;
import com.st.service.BookService;
import com.st.service.TranscactionService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.annotation.Resource;
import java.util.List;

@Controller
public class TestController {
    @Resource
    private BookService bookService;
    @Resource
    private TranscactionService transcactionService;

    @RequestMapping("main")
    public String testController() {
        return "main";
    }

    @RequestMapping("getBook")
    @ResponseBody
    public List<BookBean> getBook() {
        return bookService.getAllBooks();
    }

    @RequestMapping("zz")
    @ResponseBody
    public int zz() {
        int suc = 0;
        try {
            suc = transcactionService.zz(100);
        } catch (Exception e) {
            e.printStackTrace();
        }
        return suc;
    }
}
